Enable Brain Focus to run in background. This can be done in your phone settings battery optimization. Brain Focus should not be optimized. Note that on some phones it is called power management.
Configure Brain Focus in the list of Auto-Start Manager in the Battery Settings.
Turn off battery Advanced optimization. Going in the battery settings. Then use the top right menu to access Advanced optimization.
More information can be found on this website: https://dontkillmyapp.com/
Restart phone should fix it.